from django.db import models
from django.utils import timezone

# Create your models here.

class Kind(models.Model):
    name = models.CharField(blank=False, null=False, max_length=20, verbose_name='分类')
    class Meta:
        verbose_name = '分类'
        verbose_name_plural = verbose_name
    def __str__(self):
        return "{}".format(self.name)



class PictureShow(models.Model):
    p_name = models.CharField(max_length=100,verbose_name='图片名称',null=False,blank=False,unique=True)
    p_desc = models.CharField(max_length=1024,verbose_name='图片介绍',default='暂时没写')
    p_data = models.DateField(default=timezone.now,verbose_name='拍摄时间')
    images = models.ImageField(null=True)
    kind = models.ManyToManyField(Kind)

    class Meta:
        verbose_name = '图片信息'
        verbose_name_plural = verbose_name

    def __str__(self):
        return '{}'.format(self.p_name)






